package com.atzly.community.config;

import com.atzly.community.constant.CommentConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import java.io.File;

/**  生成长图工具配置类
 * @author zlysimida
 * @date 2021/9/5 - 8:55
 */
@Configuration
@Slf4j
public class Wkconfig implements CommentConstant {

    @Value("${wk.image.storage}")
    private String storageLocation;

    // 构造方法之后，初始化方法之前执行
    // 构造方法->依赖注入@Autowired->@PostConstruct
    @PostConstruct
    public void init() {
        File file = new File(storageLocation);
        if(!file.exists()){
            file.mkdir();
            log.info("本地wk文件目录成功!");
        }
    }

}

